package com.ship.control.impl;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;

import com.ship.control.AbstractAdminCommandController;
import com.ship.control.search.SearchStat;
import com.ship.control.search.ShipInfoSearchCond;
import com.ship.entity.ShipInfo;
import com.ship.service.ShipService;

/**
 * 人员
 * @author wqf
 * @version  Nov 24, 2011 12:00:53 PM
 */
public class ShipInfoListController extends AbstractAdminCommandController {

	public ShipInfoListController(){
		this.setCommandClass(ShipInfoSearchCond.class);
	}
	
	protected ModelAndView executeRequest(HttpServletRequest request,HttpServletResponse response,Object command)
		throws Exception{
		
		ShipInfoSearchCond shipInfoSearchCond=(ShipInfoSearchCond)command;
		
		ModelAndView mav=new ModelAndView(this.view);
		shipInfoSearchCond.setPageSize(10L);
		SearchStat searchStat=this.shipService.getSearchStat(ShipInfo.class, shipInfoSearchCond);
		List<ShipInfo> shipInfoList=this.shipService.getShipInfoList(shipInfoSearchCond);
		mav.addObject("searchStat", searchStat);
		mav.addObject("shipInfoList", shipInfoList);
		mav.addObject("shipInfoSearchCond", shipInfoSearchCond);		
				
		return mav;
		
	}
	
	public void setShipService(ShipService shipService) {
		this.shipService = shipService;
	}

	private String view;
	private ShipService shipService;
	
	public void setView(String view) {
		this.view = view;
	}

}
